<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Interactive Single Page</title>
    <style>
        :root {
            --primary: #4f46e5;
            --secondary: #e0e7ff;
            --bg: #f9fafb;
        }
        body {
            margin: 0;
            font-family: sans-serif;
            background: var(--bg);
            color: #333;
            line-height: 1.6;
        }
        header, footer {
            background: var(--primary);
            color: white;
            text-align: center;
            padding: 1rem;
        }
        section {
            padding: 2rem;
            margin: 1rem auto;
            max-width: 800px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        }
        h2 {
            border-left: 5px solid var(--primary);
            padding-left: 0.5rem;
        }
        .interactive input,
        .interactive select {
            padding: 0.5rem;
            margin: 0.5rem 0;
            border-radius: 5px;
            border: 1px solid #ccc;
            width: 100%;
        }
        .switch {
            display: flex;
            align-items: center;
            margin-top: 1rem;
        }
        .switch input {
            margin-right: 0.5rem;
        }
        .slider-container {
            margin: 1rem 0;
        }
        .slider-container input {
            width: 100%;
        }
        .hover-card {
            padding: 1rem;
            border: 1px solid #ccc;
            border-radius: 8px;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .hover-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 12px rgba(0,0,0,0.1);
        }
        @media (max-width: 600px) {
            section {
                padding: 1rem;
            }
        }
    </style>
</head>
<body>

<header>
    <h1>Interactive Demo Page</h1>
</header>

<section>
    <h2>📘 Introduction</h2>
    <p>This is a sample single-page website built using only HTML, CSS, and JavaScript.</p>
    <p>It includes layout examples, interactive components, and responsive styles.</p>
</section>

<section class="interactive">
    <h2>🧠 Your Info</h2>
    <label>Name:
        <input type="text" id="nameInput" placeholder="Enter your name">
    </label>
    <label>Favorite Language:
        <select id="languageSelect">
            <option>JavaScript</option>
            <option>Python</option>
            <option>Kotlin</option>
            <option>Rust</option>
        </select>
    </label>
    <div class="switch">
        <input type="checkbox" id="subscribeToggle">
        <label for="subscribeToggle">Subscribe to newsletter</label>
    </div>
    <button onclick="showSummary()">Show Summary</button>
    <p id="summaryOutput"></p>
</section>

<section>
    <h2>🎨 Dynamic Styling</h2>
    <label>Choose text size:
        <div class="slider-container">
            <input type="range" min="12" max="36" value="16" id="textSizeSlider">
        </div>
    </label>
    <p id="dynamicText">This paragraph will resize dynamically based on your slider input.</p>
</section>

<section>
    <h2>🪄 CSS Hover Effect</h2>
    <div class="hover-card">
        <p>This card lifts and glows on hover.</p>
    </div>
</section>

<footer>
    <p>&copy; 2025 Example. All rights reserved.</p>
</footer>

<script>
    const nameInput = document.getElementById('nameInput');
    const languageSelect = document.getElementById('languageSelect');
    const subscribeToggle = document.getElementById('subscribeToggle');
    const summaryOutput = document.getElementById('summaryOutput');

    function showSummary() {
        const name = nameInput.value || "Anonymous";
        const language = languageSelect.value;
        const subscribed = subscribeToggle.checked ? "Yes" : "No";
        summaryOutput.textContent = `Hello, ${name}. You selected ${language}. Subscribed: ${subscribed}.`;
    }

    const textSizeSlider = document.getElementById('textSizeSlider');
    const dynamicText = document.getElementById('dynamicText');
    textSizeSlider.addEventListener('input', function() {
        dynamicText.style.fontSize = `${this.value}px`;
    });
</script>

</body>
</html>
